<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/common.jsp"%>
<%@ include file="/WEB-INF/common/taglib.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<script type="text/javascript">
		$(function(){
			$('.form_datetime').datetimepicker({
				language:'zh-CN',
				format: "yyyy-mm-dd hh:ii:ss",
				weekStart: 1,
		        autoclose: true,
		        todayBtn: true,
				todayHighlight: 1,
				startView: 'month',
				forceParse: true,
		        showMeridian: 1
			});
		});
	</script>
</head>
<body>
	<div class="container bs-docs-container" style="width:100%;">
		<div class="row">
			<form role="pageForm" class="form-inline" action="<%=path%>/common/queryPageList/${tableName}.do" method="post"  id="pageForm" class="form-search">
				<div  class="col-md-12" style="width:100%;padding:5px;">
					<div class="panel panel-default">
						  <div class="panel-heading">列表界面</div>
						  <div class="panel-body">
						  		<div class="search">
						  			<c:if test="${not empty queryList}">
						  				<c:forEach items="${queryList}" var="info" varStatus="vs">
							  				<div class="form-group col-sm-4">
												<label for="${info.columnName}" class="col-sm-4 control-label" style="text-align:left;">${info.columnComment}</label>
										 		<div class="col-sm-8">
										 			<input type="text" name="${info.columnName}" id="${info.columnName}" placeholder="${info.columnComment}"  class="form-control">
								           		</div>
							           		</div>
						           		</c:forEach>
					           		 	<div class="form-group col-sm-4 ">
					     			 		<button type="submit" class="btn btn-sm btn-primary col-md-offset-1">搜索</button>
					     			 		<a type="button" class="btn btn-sm btn-primary" href="<%=path%>/common/toMerge/${tableName}.do" style="margin-left: 10px;">新增</a>
				       			 		</div>
						  			</c:if>
						  		</div>
						        <div class="col-md-12 col-sm-12 col-xs-12 table-responsive"  style="padding-top: 5px;">
						        <table class="table table-striped table-bordered table-condensed">
							        <thead>
							        	<tr class="active">
							        		<c:if test="${not empty dispalyList}">
													<c:forEach items="${dispalyList}" var="info" varStatus="vs">
														<th style="width:5%;">${info.column_comment}</th>
													</c:forEach>
													<th style="width:5%;">操作</th>
											</c:if>
			                			</tr>
							        </thead>
							        <tbody>
									        <c:choose>
												<c:when test="${not empty pagination}">
													<c:forEach items="${pagination.items}" var="info" varStatus="vs">
														<tr>
															<c:forEach items="${dispalyList}" var="item" varStatus="s">
																<td style="width:10%;">${info[item['column_name']]}</td>
															</c:forEach>
															<td class="last">
																<a href="<%=path%>/common/toMerge/${tableName}.do?${primaryKey}=${info[primaryKey]}">修改</a>
																&nbsp;&nbsp;
																<a href="<%=path%>/common/toDetail/${tableName}.do?${primaryKey}=${info[primaryKey]}">详情</a>
																&nbsp;&nbsp;
																<a onclick="HF.confirmx('确定删除该条数据','<%=path%>/common/delete/${tableName}.do?${primaryKey}=${info[primaryKey]}')">删除</a>
															</td>
														</tr>
													</c:forEach>
												</c:when>
												<c:otherwise>
														<tr><td colspan="100">没有相关数据</td></tr>
												</c:otherwise>
											</c:choose>
							         </tbody>
							    </table>
							    </div>
								<div>
									<%@ include file="/WEB-INF/common/pagination.jsp"%>
								</div>
						  </div>	
					</div>
				</div>  
			</form>
		</div>
	</div>
</body>
</html>